import request from '@/utils/request'

export const likeApi = {
  // 点赞帖子
  likePost(postId, userId) {
    return request({
      url: `/likes/posts/${postId}/users/${userId}`,
      method: 'post'
    })
  },

  // 取消点赞帖子
  unlikePost(postId, userId) {
    return request({
      url: `/likes/posts/${postId}/users/${userId}`,
      method: 'delete'
    })
  },

  // 点赞评论
  likeComment(commentId, userId) {
    return request({
      url: `/likes/comments/${commentId}/users/${userId}`,
      method: 'post'
    })
  },

  // 取消点赞评论
  unlikeComment(commentId, userId) {
    return request({
      url: `/likes/comments/${commentId}/users/${userId}`,
      method: 'delete'
    })
  },

  // 检查帖子点赞状态
  isPostLiked(postId, userId) {
    return request({
      url: `/likes/posts/${postId}/users/${userId}/status`,
      method: 'get'
    })
  },

  // 检查评论点赞状态
  isCommentLiked(commentId, userId) {
    return request({
      url: `/likes/comments/${commentId}/users/${userId}/status`,
      method: 'get'
    })
  },

  // 获取帖子点赞数
  getPostLikeCount(postId) {
    return request({
      url: `/likes/posts/${postId}/count`,
      method: 'get'
    })
  },

  // 获取评论点赞数
  getCommentLikeCount(commentId) {
    return request({
      url: `/likes/comments/${commentId}/count`,
      method: 'get'
    })
  }
} 